// reset
*{
    box-sizing: border-box;
    outline: none;
}
html{
    font-size: 13px;
}

body{
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.2em;
    background: #f1f1f1;
}
a{
    color: #999;
}

p{
    line-height: 1.5rem;
}
// color
$colors:(
    'primary':#db9e3f,
    'info': #4b67af,
    "white":#fff,
    "black":#000,
    'dark':#222,
    'grey-1':#666,
    "grey":#999,
    "light":#f9f9f9,
    'dark-1':#343440,
    'light-1':#d4d0de,
);

$border-color:map-get($colors,'light-1');

@each $colorKey,$color in $colors {
    // 文本颜色
    .text-#{$colorKey}{
        color: $color 
    }

    // 背景颜色
    .bg-#{$colorKey}{
        background-color: $color 
    }
}
    

// text
@each $var in (left,center,right) {
    .text-#{$var}{
        text-align: $var;
    }
}

$base-font-size:1rem;
$font-sizes: (
    xss:.6154,
    xs:.7692,
    sm:.923077,
    md:1,
    lg:1.0769,
    xl:1.2308
);

@each $sizeKey,$size in $font-sizes {
    .fs-#{$sizeKey}{
        font-size: $size * $base-font-size;
    }
}

// width,height
.w-100{
    width:100%
}

.h-100{
    height: 100%;
}

// flex布局
.d-flex{
    display: flex;
}

.flex-column{
    flex-direction: column;
}

.flex-wrap{
    flex-wrap:wrap;
}

$flex-jc:(
    start:flex-start,
    end:flex-end,
    center:center,
    between:space-between,
    around:space-around
);

@each $key,$value in $flex-jc {
    .jc-#{$key}{
        justify-content: $value;
    }
}

$flex-ai:(
    start:flex-start,
    end:flex-end,
    center:center,
    stretch:stretch
);

@each $key,$value in $flex-ai {
    .ai-#{$key}{
        align-items: $value;
    }
}

.flex-1{
    flex: 1;
}

// 边距布局
$spacing-types:(
    m:margin,
    p:padding
);

$spacing-direction:(
    t:top,
    b:bottom,
    l:left,
    r:right,
);

$spacing-base-size:1rem;

$spacing-sizes:(
    0:0,
    1:0.25,
    2:0.5,
    3:1,
    4:1.5,
    5:3
);

@each $typeskey,$typesvalue in $spacing-types {
    // .m-1
    @each $sizeskey,$sizesvalue in $spacing-sizes {
        .#{$typeskey}-#{$sizeskey}{
            #{$typesvalue}:$sizesvalue * $spacing-base-size
        }
    }

    // .mx-1,.my-1
    @each $sizeskey,$sizesvalue in $spacing-sizes {
        .#{$typeskey}x-#{$sizeskey}{
            #{$typesvalue}-left:$sizesvalue * $spacing-base-size;
            #{$typesvalue}-right:$sizesvalue * $spacing-base-size;
        }
        .#{$typeskey}y-#{$sizeskey}{
            #{$typesvalue}-top:$sizesvalue * $spacing-base-size;
            #{$typesvalue}-bottom:$sizesvalue * $spacing-base-size;
        }
    }
    

    // mt-1
    @each $directionkey,$directionvalue in $spacing-direction {
        @each $sizeskey,$sizesvalue in $spacing-sizes {
            .#{$typeskey}#{$directionkey}-#{$sizeskey}{
                #{$typesvalue}-#{$directionvalue}:$sizesvalue * $spacing-base-size
            }
        }
    }
}

// 页面布局
.btn{
    font-size: map-get($font-sizes,'sm') * $base-font-size;
    border: none;
    border-radius: 0.1538rem;
    padding:0.2rem 0.6rem;
}

.nav{
    display: flex;
    .nav-item{
        border-bottom: 0.2rem solid transparent;
        padding-bottom: 0.2rem;
        &.active{
            color:map-get($colors, 'primary' );
            border-bottom-color:  map-get($colors, 'primary' );
        }
    }
    &.nav-inverse{
        .nav-item{
            color:map-get($colors, 'white' );
            &.active{
                border-bottom-color: map-get($colors, 'white' );
            }
        }
    }
}

// 精灵图布局
.sprite{
    background: url('../img/index.png') no-repeat 0 0;
    background-size: 28.8462rem;
    display: inline-block;
    &.sprite-news{
        width: 1.7692rem;
	    height: 1.5385rem;
        background-position: 63.546% 15.517%
    }
    &.sprite-new{
        width: 1.7692rem;
	    height: 1.5385rem;
        background-position: 90.483% 15.614%
    }
    &.sprite-market{
        width: 1.7692rem;
	    height: 1.5385rem;
        background-position: 36.746% 0.924%
    }
    &.sprite-attempt{
        width: 1.5385rem;
	    height: 1.5385rem;
        background-position: 10.408% 15.517%
    }
    &.sprite-newman{
        width: 1.5385rem;
	    height: 1.6154rem;
        background-position: 89.733% 1.266%
    }
    &.sprite-honor{
        width: 1.8462rem;
        height: 1.5385rem;
        background-position: 36.467% 15.287%;
    }
    &.sprite-home{
        width: 1.8462rem;
        height: 1.8462rem;
        background-position: 63.3% 0.927%
    }
    &.sprite-wx{
        width: 1.8462rem;
        height: 1.5385rem;
        background-position: 0 96.207%
    }
    &.sprite-banben{
        width: 1.8462rem;
        height: 1.6923rem;
        background-position: 63.39% 41.292%
    }
    &.sprite-idea{
        width: 2.3846rem;
        height: 1.9231rem;
        background-position: 9.302% 0.813%;
    }
    &.sprite-fun{
        width: 1.5385rem;
	    height: 1.9231rem;
        background-position: 10.408% 27.209%;
    }
    &.sprite-if{
        width: 1.7692rem;
	    height: 1.5385rem;
        background-position: 63.546% 15.517%;
    }
    &.sprite-arrow{
        width: .7692rem;
	    height: .7692rem;
        background-position: 38.577% 52.076%;
    }
}